package com.qq.BFMRSE.entity;
import java.io.Serializable;
public class SimpleHash implements Serializable{
	private static final long serialVersionUID = 5L;
	private int cap;
	private int seed;
	public int getCap()
	{
		return cap;
	}
	public void setCap(int cap)
	{
		this.cap=cap;
	}
	public int getSeed()
	{
		return seed;
	}
	public void setSeed()
	{
		this.seed=seed;
	}
	public SimpleHash(int cap,int seed)
	{
		this.cap=cap;
		this.seed=seed;
	}
	public int Hash(String value)
	{
		int result = 0;  
        int len = value.length();  
        for (int i = 0; i < len; i++) {  
            result = seed * result + value.charAt(i);  
        }  
        return (cap - 1) & result;  
	}
}
